<template>
  <ElFormItem
    :label="titleText(options, item)"
    :prop="[childIndex, 'value']"
    :rules="{
      required: item.isRequired === 'Y',
      message: '请选择',
      trigger: 'change',
    }"
    class="flex_column"
  >
    <p v-if="options.showDesc" class="desc f12 mb10">
      {{ options.description }}
    </p>
    <ElDatePicker
      v-model="item.value"
      :disabled="type === 'view'"
      class="pc_w300"
      format="YYYY年MM月DD日"
      placeholder="请选择"
      type="date"
      value-format="YYYY年MM月DD日"
      @change="onChange"
    />
  </ElFormItem>
</template>

<script setup>
import { titleText } from "@/utils/common.js";
import { ElDatePicker, ElFormItem } from "element-plus";
import { } from "vue";

//defineOptions({ name: "PCDate" });

const { item, type, index, childIndex } = defineProps([
  "item",
  "type",
  "index",
  "childIndex",
]);
const emits = defineEmits(["change"]);
const { options } = JSON.parse(item.vformJson);
// 传递值改变后
const onChange = (date) => emits("change", item);
</script>